﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace HHCloud.Model.Models
{
    public partial class HHXXDBContext : DbContext
    {
        public HHXXDBContext()
        {
        }

        public HHXXDBContext(DbContextOptions<HHXXDBContext> options)
            : base(options)
        {
        }

        public virtual DbSet<UserInfoSet> UserInfoSet { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                //#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlServer("Server=127.0.0.1;Database=HHXXDb;uid=sa;pwd=123456;Packet Size=512;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<UserInfoSet>(entity =>
            {
                entity.Property(e => e.ModifiedOn).HasColumnType("datetime");

                entity.Property(e => e.Pwd)
                    .IsRequired()
                    .HasMaxLength(32);

                entity.Property(e => e.Remark).HasMaxLength(256);

                entity.Property(e => e.ShowName)
                    .IsRequired()
                    .HasMaxLength(64);

                entity.Property(e => e.SubTime).HasColumnType("datetime");

                entity.Property(e => e.Uname)
                    .HasColumnName("UName")
                    .HasMaxLength(32);
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
